package com.trkj.vo;

public class Information {
	 private boolean success; // 是否成功
	    private String message = ""; // 如果失败，失败原因
	    
	    public static final String FAILURE = "操作失败！";
	    
	    
	    public Information() {
	        success = true;
	    }

	    public Information(String message) {
	        super();
	        this.message = message;
	    }

	    public boolean isSuccess() {
	        return success;
	    }

	    public void setSuccess(boolean success) {
	        this.success = success;
	    }

	    public String getMessage() {
	        return message;
	    }

	    public void setMessage(String message) {
	        this.message = message;
	    }

	    public static Information getInstance(boolean b, Exception e){
	        if(b){
	            return new Information();
	        }else{
	            return new Information(e.getMessage());
	        }
	    }
	    
	    public static Information getInstance(boolean b, String s){
	        if(b){
	            return new Information();
	        }else{
	            return new Information(s);
	        }
	    }
	    
	    public static Information getInstance(boolean b){
	        return getInstance(b, FAILURE);
	    }
}
